public class Test3 {
    public static void main(String[] args) {
        String str="leedcode";
        System.out.println(Solution.solution(str));

    }
}
class Solution{
    public static int solution(String str){
        int[] ch=new int[26];
        for (int i = 0; i <str.length() ; i++) {
            int count=0;
            char c=str.charAt(i);
            ch[c-97]++;
        }
        for (int j = 0; j <str.length() ; j++) {
            if(ch[str.charAt(j)-'a']==1)
                return j;
        }
        return -1;
    }
}